package com.acc.sys.framework;

import apijson.NotNull;
import apijson.RequestMethod;
import apijson.framework.APIJSONObjectParser;
import apijson.orm.SQLConfig;
import com.alibaba.fastjson.JSONObject;
import jakarta.servlet.http.HttpSession;

import java.util.List;

public class AccObjectParser extends APIJSONObjectParser<Long> {

    public AccObjectParser(HttpSession session, @NotNull JSONObject request, String parentPath, SQLConfig arrayConfig, boolean isSubquery, boolean isTable, boolean isArrayMainTable) throws Exception {
        super(session, request, parentPath, arrayConfig, isSubquery, isTable, isArrayMainTable);
    }

    public SQLConfig<Long> newSQLConfig(RequestMethod method, String table, String alias, JSONObject request, List list, boolean isProcedure) throws Exception {
//        if (method == RequestMethod.POST) {
//            request.put("create_admin_id", StpUtil.getLoginId());
//            request.put("create_time", DateUtil.now());
//        } else if (method == RequestMethod.PUT) {
//            request.put("update_admin_id", StpUtil.getLoginId());
//            request.put("update_time", DateUtil.now());
//        }
        return AccSQLConfig.newSQLConfig(method, table, alias, request, this.joinList, isProcedure);
    }
}
